(function(vc,vm){

    vc.extends({
        data:{
            editGovPersonDieInfo:{
                dieId:'',
dieId:'',
govPersonId:'',
caId:'',
govCommunityId:'',
personType:'',
dieType:'',
diePlace:'',
imgProve:'',
dieTime:'',
startTime:'',
endTime:'',
funeralPlace:'',
contactPerson:'',
contactTel:'',
ramark:'',
statusCd:'',

            }
        },
         _initMethod:function(){

         },
         _initEvent:function(){
             vc.on('editGovPersonDie','openEditGovPersonDieModal',function(_params){
                vc.component.refreshEditGovPersonDieInfo();
                $('#editGovPersonDieModel').modal('show');
                vc.copyObject(_params, vc.component.editGovPersonDieInfo );
                vc.component.editGovPersonDieInfo.caId = vc.getCurrentCommunity().caId;
            });
        },
        methods:{
            editGovPersonDieValidate:function(){
                        return vc.validate.validate({
                            editGovPersonDieInfo:vc.component.editGovPersonDieInfo
                        },{
                            'editGovPersonDieInfo.dieId':[
{
                            limit:"required",
                            param:"",
                            errInfo:"记录ID不能为空"
                        },
 {
                            limit:"maxLength",
                            param:"30",
                            errInfo:"记录ID不能超过30"
                        },
                    ],
'editGovPersonDieInfo.govPersonId':[
{
                            limit:"required",
                            param:"",
                            errInfo:"人口编号不能为空"
                        },
 {
                            limit:"maxLength",
                            param:"30",
                            errInfo:"人口编号不能超过30"
                        },
                    ],
'editGovPersonDieInfo.caId':[
{
                            limit:"required",
                            param:"",
                            errInfo:"区域ID不能为空"
                        },
 {
                            limit:"maxLength",
                            param:"30",
                            errInfo:"区域ID不能超过30"
                        },
                    ],
'editGovPersonDieInfo.govCommunityId':[
{
                            limit:"required",
                            param:"",
                            errInfo:"小区ID不能为空"
                        },
 {
                            limit:"maxLength",
                            param:"30",
                            errInfo:"小区ID不能超过30"
                        },
                    ],
'editGovPersonDieInfo.personType':[
{
                            limit:"required",
                            param:"",
                            errInfo:"人员类型不能为空"
                        },
 {
                            limit:"maxLength",
                            param:"30",
                            errInfo:"人员类型不能超过30"
                        },
                    ],
'editGovPersonDieInfo.dieType':[
{
                            limit:"required",
                            param:"",
                            errInfo:"去世类型不能为空"
                        },
 {
                            limit:"maxLength",
                            param:"30",
                            errInfo:"去世类型不能超过30"
                        },
                    ],
'editGovPersonDieInfo.diePlace':[
{
                            limit:"required",
                            param:"",
                            errInfo:"去世地点/名称不能为空"
                        },
 {
                            limit:"maxLength",
                            param:"200",
                            errInfo:"去世地点/名称不能超过200"
                        },
                    ],
'editGovPersonDieInfo.imgProve':[
{
                            limit:"required",
                            param:"",
                            errInfo:"去世证明图片不能为空"
                        },
 {
                            limit:"maxLength",
                            param:"200",
                            errInfo:"去世证明图片不能超过200"
                        },
                    ],
'editGovPersonDieInfo.dieTime':[
{
                            limit:"required",
                            param:"",
                            errInfo:"去世时间不能为空"
                        },
 {
                            limit:"maxLength",
                            param:"时间类型",
                            errInfo:"去世时间不能超过时间类型"
                        },
                    ],
'editGovPersonDieInfo.startTime':[
{
                            limit:"required",
                            param:"",
                            errInfo:"预计开始时间不能为空"
                        },
 {
                            limit:"maxLength",
                            param:"时间类型",
                            errInfo:"预计开始时间不能超过时间类型"
                        },
                    ],
'editGovPersonDieInfo.endTime':[
{
                            limit:"required",
                            param:"",
                            errInfo:"预计结束时间不能为空"
                        },
 {
                            limit:"maxLength",
                            param:"时间类型",
                            errInfo:"预计结束时间不能超过时间类型"
                        },
                    ],
'editGovPersonDieInfo.funeralPlace':[
{
                            limit:"required",
                            param:"",
                            errInfo:"葬礼地点/名称不能为空"
                        },
 {
                            limit:"maxLength",
                            param:"200",
                            errInfo:"葬礼地点/名称不能超过200"
                        },
                    ],
'editGovPersonDieInfo.contactPerson':[
{
                            limit:"required",
                            param:"",
                            errInfo:"家人联系人不能为空"
                        },
 {
                            limit:"maxLength",
                            param:"64",
                            errInfo:"家人联系人不能超过64"
                        },
                    ],
'editGovPersonDieInfo.contactTel':[
{
                            limit:"required",
                            param:"",
                            errInfo:"家人联系电话不能为空"
                        },
 {
                            limit:"maxLength",
                            param:"11",
                            errInfo:"家人联系电话不能超过11"
                        },
                    ],
'editGovPersonDieInfo.ramark':[
{
                            limit:"required",
                            param:"",
                            errInfo:"备注不能为空"
                        },
 {
                            limit:"maxLength",
                            param:"1024",
                            errInfo:"备注不能超过1024"
                        },
                    ],
'editGovPersonDieInfo.statusCd':[
{
                            limit:"required",
                            param:"",
                            errInfo:"数据状态不能为空"
                        },
 {
                            limit:"maxLength",
                            param:"2",
                            errInfo:"数据状态不能超过2"
                        },
                    ],
'editGovPersonDieInfo.dieId':[
{
                            limit:"required",
                            param:"",
                            errInfo:"死亡登记ID不能为空"
                        }]

                        });
             },
            editGovPersonDie:function(){
                if(!vc.component.editGovPersonDieValidate()){
                    vc.toast(vc.validate.errInfo);
                    return ;
                }

                vc.http.apiPost(
                    '/govPersonDie/updateGovPersonDie',
                    JSON.stringify(vc.component.editGovPersonDieInfo),
                    {
                        emulateJSON:true
                     },
                     function(json,res){
                        //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
                        let _json = JSON.parse(json);
                        if (_json.code == 0) {
                            //关闭model
                            $('#editGovPersonDieModel').modal('hide');
                             vc.emit('govPersonDieManage','listGovPersonDie',{});
                            return ;
                        }
                        vc.message(_json.msg);
                     },
                     function(errInfo,error){
                        console.log('请求失败处理');

                        vc.message(errInfo);
                     });
            },
            refreshEditGovPersonDieInfo:function(){
                vc.component.editGovPersonDieInfo= {
                  dieId:'',
dieId:'',
govPersonId:'',
caId:'',
govCommunityId:'',
personType:'',
dieType:'',
diePlace:'',
imgProve:'',
dieTime:'',
startTime:'',
endTime:'',
funeralPlace:'',
contactPerson:'',
contactTel:'',
ramark:'',
statusCd:'',

                }
            }
        }
    });

})(window.vc,window.vc.component);
